package cn.panda.edu.service.impl;

import cn.panda.edu.dao.EducationMapper;
import cn.panda.edu.model.Education;
import cn.panda.edu.service.EducationService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 
 * 类描述：  教学计划
 */
@Service
public class EducationServiceImpl implements EducationService {

	@Autowired
	private EducationMapper educationMapper;
	@Override
	public PageInfo<Education> listEduByMajorIdAndPage(Integer majorId, Integer pageIndex, Integer pageSize) {
		// TODO Auto-generated method stub
		PageHelper.startPage(pageIndex, pageSize);
		List<Education> list = educationMapper.listEducationByMajorId(majorId);
		PageInfo<Education> pageInfo = new PageInfo<>(list);
		return pageInfo;
	}

	@Override
	public int deleteByPrimaryKey(Integer educationPlanId) {
		// TODO Auto-generated method stub
		return educationMapper.deleteByPrimaryKey(educationPlanId);
	}

	@Override
	public int insert(Education record) {
		// TODO Auto-generated method stub
		return educationMapper.insert(record);
	}

	@Override
	public int insertSelective(Education record) {
		// TODO Auto-generated method stub
		return educationMapper.insertSelective(record);
	}

	@Override
	public Education selectByPrimaryKey(Integer educationPlanId) {
		// TODO Auto-generated method stub
		return educationMapper.selectByPrimaryKey(educationPlanId);
	}

	@Override
	public int updateByPrimaryKeySelective(Education record) {
		// TODO Auto-generated method stub
		return educationMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKey(Education record) {
		// TODO Auto-generated method stub
		return educationMapper.updateByPrimaryKey(record);
	}

	@Override
	public PageInfo<Education> selectAll(Integer pageIndex, Integer pageSize) {
		// TODO Auto-generated method stub
		System.out.println(pageIndex);
		PageHelper.startPage(pageIndex, pageSize);
		List<Education> eList = educationMapper.selectAll();
		PageInfo<Education> pageInfo = new PageInfo<>(eList);
		return pageInfo;
	}

	


	

	

}
